import http from './request'
import { AxiosRequestConfig, AxiosResponse } from 'axios';

interface RequestParams<T> {
    url: string;
    method: string;
    data?: T;
}
// 定义一个范型函数，用于发送 GET 请求
export function getRequestCgi<T>(url: string, config?: AxiosRequestConfig): Promise<AxiosResponse<T>> {
    return http.get<T>(url, config);
}

// 定义一个范型函数，用于发送 POST 请求
export function postRequestCgi<T>(params: RequestParams<T>, config?: AxiosRequestConfig): Promise<AxiosResponse<T>> {
    return http.post<T>(params.url, params.data, config);
}

export default http;